/***************************************************************
 *  Copyright (c) 2007 by GroupMe! Team (www.groupme.net)
 *  All rights reserved
 *
 *  This file is part of the GroupMe! Project. You can utilize
 *  software of the GroupMe! project under the terms of the 
 *  GNU Lesser General Public License as published by the
 *  Free Software Foundation in version 2.1.
 * 
 *  The GNU Lesser General Public License can be found at:
 *  http://www.gnu.org/licenses/lgpl.html
 *
 *  This copyright notice MUST APPEAR in all copies of the file!
 ***************************************************************/
package net.groupme.model;

import java.net.URI;
import java.net.URL;
import java.util.Collection;

import net.groupme.exceptions.DeleteFailedException;
import net.groupme.exceptions.GroupVisualizationException;
import net.groupme.exceptions.InsertFailedException;
import net.groupme.exceptions.UpdateFailedException;
import net.groupme.model.dao.GroupDAO;

/**
 * This class implements a Group object {@link net.groupme.model.Group} in the
 * GroupMe! project. created on 16.04.2007
 * 
 * @author Mischa Frank <a
 *         href="mailto:code@planetfrank.net">code@planetfrank.net</a>
 * @author Fabian Abel, <a href="mailto:abel@l3s.de">abel@l3s.de</a>
 * @author last edited by: $Author: fabian $
 * 
 * @version $Revision: 1.7 $ $Date: 2008-06-12 12:17:16 $
 * 
 */
public class GroupImpl extends ResourceImpl implements Group {

	private GroupDAO groupDAO = null;

	public GroupImpl(GroupDAO groupDAO) {
		super(groupDAO);
		this.groupDAO = groupDAO;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see net.groupme.model.Group#addResource(net.groupme.model.Resource)
	 */
	public void addResource(Resource resource) throws InsertFailedException {
		this.groupDAO.addResource(resource);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see net.groupme.model.Resource#addTag(net.groupme.model.User,
	 *      net.groupme.model.Tag)
	 */
	public void addTag(User tagger, Tag tag) throws InsertFailedException {
		this.groupDAO.addTag(tagger, tag);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see net.groupme.model.Resource#addTag(net.groupme.model.User,
	 *      net.groupme.model.Tag, net.groupme.model.Group)
	 */
	public void addTag(User tagger, Tag tag, Group group)
			throws InsertFailedException {
		this.groupDAO.addTag(tagger, tag, group);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see net.groupme.model.Resource#addTag(net.groupme.model.User,
	 *      net.groupme.model.Tag, net.groupme.model.Group, java.lang.Double)
	 */
	public void addTag(User tagger, Tag tag, Group group, Double importance)
			throws InsertFailedException {
		this.groupDAO.addTag(tagger, tag, group, importance);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see net.groupme.model.Group#addUser(java.lang.String,
	 *      net.groupme.model.User)
	 */
	public void addUser(String role, User user) throws InsertFailedException {
		this.groupDAO.addUser(role, user);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see net.groupme.model.Group#addVisualization(net.groupme.model.GroupVisualization,
	 *      net.groupme.model.User)
	 */
	public void addVisualization(GroupVisualization groupVisualization,
			User user) throws InsertFailedException {
		this.groupDAO.addVisualization(groupVisualization, user);
	}

	/* (non-Javadoc)
	 * @see net.groupme.model.Group#getActualGroupVisualization(java.lang.String)
	 */
	public GroupVisualization getActualGroupVisualization(String userID) throws GroupVisualizationException {
		return this.groupDAO.getActualGroupVisualization(userID);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see net.groupme.model.Resource#getDescription()
	 */
	public String getDescription() {
		return this.groupDAO.getDescription();
	}
	
	/*
	 * (non-Javadoc)
	 * 
	 * @see net.groupme.model.Identifiable#getLabel()
	 */
	public String getLabel() {
		return this.groupDAO.getLabel();
	}
	/*
	 * (non-Javadoc)
	 * 
	 * @see net.groupme.model.Group#getURLOfAPictureInGroup()
	 */
	public String getURLOfAPictureInGroup() {
		return this.groupDAO.getURLOfAPictureInGroup();
	}
	/*
	 * (non-Javadoc)
	 * 
	 * @see net.groupme.model.Resource#getName()
	 */
	public String getName() {
		return this.groupDAO.getName();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see net.groupme.model.Group#getResources()
	 */
	public Collection<Resource> getResources() {
		return this.groupDAO.getResources();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see net.groupme.model.Group#getStandardVisualization()
	 */
	public GroupVisualization getStandardVisualization() {
		return this.groupDAO.getStandardVisualization();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see net.groupme.model.Resource#getTags()
	 */
	public Collection<Tag> getTags() {
		return this.groupDAO.getTags();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see net.groupme.model.Resource#getTags(net.groupme.model.Group)
	 */
	public Collection<Tag> getTags(Group group) {
		return this.groupDAO.getTags(group);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see net.groupme.model.Resource#getDateCreated(net.groupme.model.Group)
	 */
	public String getDateCreated(){
		return this.groupDAO.getDateCreated();
	}
	/*
	 * (non-Javadoc)
	 * 
	 * @see net.groupme.model.Resource#getTags(net.groupme.model.User)
	 */
	public Collection<Tag> getTags(User tagger) {
		return this.groupDAO.getTags(tagger);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see net.groupme.model.Resource#getTags(net.groupme.model.User,
	 *      net.groupme.model.Group)
	 */
	public Collection<Tag> getTags(User tagger, Group group) {
		return this.groupDAO.getTags(tagger, group);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see net.groupme.model.Resource#getType()
	 */
	public String getType() {
		return this.groupDAO.getType();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see net.groupme.model.Identifiable#getURI()
	 */
	public URI getURI() {
		return this.groupDAO.getURI();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see net.groupme.model.Resource#getURL()
	 */
	public URL getURL() {
		return this.groupDAO.getURL();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see net.groupme.model.Group#getUsers()
	 */
	public Collection<User> getUsers() {
		return this.groupDAO.getUsers();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see net.groupme.model.Group#getUsers(java.lang.String)
	 */
	public Collection<User> getUsers(String role) {
		return this.groupDAO.getUsers(role);
	}

	/* (non-Javadoc)
	 * @see net.groupme.model.Group#getCreators()
	 */
	public Collection<User> getCreators() {
		return this.groupDAO.getCreators();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see net.groupme.model.Group#getVisualizations()
	 */
	public Collection<GroupVisualization> getVisualizations() {
		return this.groupDAO.getVisualizations();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see net.groupme.model.Group#getVisualizations(net.groupme.model.User)
	 */
	public Collection<GroupVisualization> getVisualizations(User user) {
		return this.groupDAO.getVisualizations(user);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see net.groupme.model.Group#removeResource(net.groupme.model.Resource)
	 */
	public void removeResource(Resource resource) throws DeleteFailedException {
		this.groupDAO.removeResource(resource);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see net.groupme.model.Resource#removeTag(net.groupme.model.User,
	 *      net.groupme.model.Tag, net.groupme.model.Group)
	 */
	public void removeTag(User tagger, Tag tag, Group group)
			throws DeleteFailedException {
		this.groupDAO.removeTag(tagger, tag, group);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see net.groupme.model.Group#removeUser(net.groupme.model.User)
	 */
	public void removeUser(User user) throws DeleteFailedException {
		this.groupDAO.removeUser(user);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see net.groupme.model.Group#removeVisualization(net.groupme.model.GroupVisualization,
	 *      net.groupme.model.User)
	 */
	public void removeVisualization(GroupVisualization groupVisualization,
			User user) throws DeleteFailedException {
		this.groupDAO.removeVisualization(groupVisualization, user);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see net.groupme.model.Identifiable#setDescription(java.lang.String)
	 */
	public void setDescription(String description) throws UpdateFailedException {
		this.groupDAO.setDescription(description);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see net.groupme.model.Identifiable#setLabel(java.lang.String)
	 */
	public void setLabel(String label) {
		this.groupDAO.setLabel(label);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see net.groupme.model.Resource#setName(java.lang.String)
	 */
	public void setName(String name) throws UpdateFailedException {
		this.groupDAO.setName(name);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see net.groupme.model.Group#setStandardVisualization(net.groupme.model.GroupVisualization)
	 */
	public void setStandardVisualization(GroupVisualization groupVisualization) {
		this.groupDAO.setStandardVisualization(groupVisualization);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see net.groupme.model.Resource#setType(java.lang.String)
	 */
	public void setType(String type) throws UpdateFailedException {
		this.groupDAO.setType(type);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see net.groupme.model.Resource#setURL(java.net.URL)
	 */
	public void setURL(URL url) throws UpdateFailedException {
		this.groupDAO.setURL(url);
	}


}
